import request from '@/utlis/request.js'

/**
 *登录请求
 * @param {String} mobile 手机号
 * @param {String} code 验证码
 */
export const reqLogin = (mobile, code) =>
  request({
    method: 'post',
    url: '/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
  /**
   * 获取验证码
   * @param {*} mobile 手机号
   */
export const reqSendCode = (mobile) =>
  request({
    method: 'get',
    url: '/v1_0/sms/codes/' + mobile
  })

/**
   * 刷新token信息
   * @param {*} refreshToken 刷新token
   * @returns
   */
export const reqRefreshToken = (refreshToken) => request({
  method: 'put',
  url: '/v1_0/authorizations',
  headers: {
    Authorization: `Bearer ${refreshToken}`
  }
})
